/*
 * @lc app=leetcode.cn id=1800 lang=javascript
 *
 * [1800] 最大升序子数组和
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {number}
 */
var maxAscendingSum = function (nums) {
  const result = [nums[0]];
  for (let i = 1; i < nums.length; i++) {
    if (nums[i] > nums[i - 1]) {
      result[i] = result[i - 1] + nums[i];
    } else {
      result[i] = nums[i];
    }
  }
  return Math.max(...result);
};
// @lc code=end

